package nl.liacs.swi.tower;

import java.util.List;

public class HealTower extends Tower {
	
	public HealTower(float alpha) {
		super(alpha);
	}

	private int range = 100;
	private int healPower = 5;
	private int RELOAD_TIME = 100;
	
	@Override
	public void update(List<Ant> ants,List<Tower> towers) {
		if(this.isDead())
			return;
		tick++;
		if (tick == RELOAD_TIME) {
			this.healTowers(towers);
			
		}
		if (tick > RELOAD_TIME) {
			tick = 0;
		}
	}
	
	private void healTowers(List<Tower> towers){
		for(Tower tower: towers){
			//if(!tower.instanceof(HealTower) && inRange(tower)){
			//	tower.heal(healPower);
			//}
		}
	}
	
	private boolean inRange(Tower tower){
		if ((tower.getX() > this.x - range) && (tower.getX() < this.x + range) && (tower.getY() < this.y + range)
				&& (tower.getY() < this.y + range)) {
			return true;
		}
		return false;
	}
	
	/**
	 * this method gets called from the ant if he bits a tower
	 */
	public void getsShot(int firePower){
	}

}
